<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header"></head>
<body class="hold-transition skin-blue sidebar-mini">
<section class="content-header"><h1>计划变更查询</h1></section>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <form id="queryForm" onsubmit="return false;">
                        <div class="row">
                            <div class="form-inline">
                                <div class="form-group">
                                    <label>物料描述</label>
                                    <input type="text" name="spcMatDesc" class="form-control" placeholder="请输入物料描述">
                                </div>
                                <div class="form-group">
                                    <label>项目编号</label>
                                    <input type="text" name="spcProjectCode" class="form-control" placeholder="请输入项目编号">
                                </div>
                                <div class="form-group">
                                    <label>项目名称</label>
                                    <input type="text" name="spcProjectName" class="form-control" placeholder="请输入项目名称">
                                </div>
                                <div class="form-group">
                                    <label>跟踪号</label>
                                    <input type="text" name="spcTrackNo" class="form-control" placeholder="请输入跟踪号">
                                </div>
                                <div class="form-group">
                                    <label>变更原因</label>
                                    <input type="text" name="spcReason" class="form-control" placeholder="请输入变更原因">
                                </div>
                                <div class="form-group">
                                    <label>状态</label>
                                    <select name="spcImportStatus" class="form-control">
                                        <option value="" selected="selected">全部</option>
                                        <option value="1">未导入</option>
                                        <option value="2">已导入</option>
                                    </select>
                                </div>
                                <div class="form-group">
                                    <label>变更日期</label>
                                    <input type="text" class="form-control datepicker" name="startTime" id="startTime" readonly="readonly"/>
                                    <span> 至 </span>
                                    <input type="text" class="form-control datepicker" name="endTime" id="endTime" readonly="readonly"/>
                                </div>
                                <button type="button" class="btn btn-success" id="btn-search">
                                    <span class="Bold">搜索</span>
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="box-body">
                    <table id="bootstrap-table"></table>
                </div>
            </div>
        </div>
    </div>
</section>
<div th:include="include :: footer"></div>
<script th:inline="javascript">

    var table, typeName=['','数量','物料'], importName=['','未导入','已导入'];
    var colors = ['', "label-default", "label-success"];

    $(function () {
        $("title").html($("title").html()+" —— 计划变更查询");
        $("#startTime").val([[${start}]]);
        $("#endTime").val([[${end}]]);
        $("#startTime").datepicker('setDate', [[${start}]]);
        $("#endTime").datepicker('setDate',[[${end}]]);
        /** 计划变更表格 */
        table = js.table.init({
            url: ctx + "buy/planChangeQuery/list",
            showColumns: false,
            showExport: false,
            columns: [
                {
                    title: '序号', field: 'id', width: '50px',
                    formatter: function (value, row, index, field) {
                        return index + 1;
                    }
                },
                { title: "物料描述", field: 'spcMatDesc'},
                { title: "变更前数量", field: 'spcNum'},
                { title: "变更后数量", field: 'spcNewNum'},
                { title: "单位", field: 'spcUnit'},
                { title: "项目号", field: 'spcProjectCode'},
                { title: "项目信息", field: 'spcProjectName'},
                { title: "变更后跟踪号", field: 'spcTrackNo'},
                { title: "变更原因", field: 'spcReason'},
                { title: "变更日期", field: 'spcChangeTime'},
                {
                    title: "状态", field: 'spcImportStatus',
                    formatter: function (value, row, index, field) {
                        if (value){
                            return '<span class="badge ' + colors[value] + '">' + importName[value] + '</span> ';
                        }

                    }
                }
            ]
        });

        /**
         * 表格搜索
         */
        $("#btn-search").click(function () {
            js.table.search(table);
        });
    });

</script>
</body>
</html>
